﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace BoardBroker
{
    public enum USB_CONTROL_ACTION_STATUS : int
    {
        Done = 0x00,	        // USB控制通断板动作执行成功
        Failed = 0xEA61,		// USB控制通断板动作执行失败  
    };

    /// <summary>
    /// USB通断板板控制动作命令
    /// </summary>
    public enum USBControlCommand : int
    {
        Init = 0x00,                       // 初始化设备        
        Exit = 0xFF,                       // 退出程序    
        Connect = 0x01,              // 连接    
        Disconnect = 0x02,          // 断开
        PullAndPlugIn = 0x03,     // 模拟拔插，断开再连接
    };

    [DataContract]
    public class USBControlCommandArgs
    {
        /// <summary>
        /// 执行动作类型
        /// </summary>
        [DataMember]
        public USBControlCommand Command { get; set; }

        /// <summary>
        /// USB通道索引
        /// </summary>
        [DataMember]
        public int Channel { get; set; }

        /// <summary>
        /// 发送命令者的窗口句柄
        /// </summary>
        [DataMember]
        public IntPtr SenderHandle { get; set; }
    }

    public class USBControlActionResult
    {
        /// <summary>
        /// 执行动作类型
        /// </summary>
        public USBControlCommand Command { get; set; }

        /// <summary>
        /// USB通道索引
        /// </summary>
        public int Channel { get; set; }

        /// <summary>
        /// 动作执行完成返回的代码
        /// </summary>
        public int Code { get; set; }

        /// <summary>
        /// 动作执行完成返回的信息
        /// </summary>
        public string Message { get; set; }
    }

}
